package top.tangyh.lamp.care.mapper;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import top.tangyh.basic.base.mapper.SuperMapper;
import top.tangyh.lamp.care.entity.BHl7Gm;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * 过敏史
 * </p>
 *
 * @author zqb
 * @date 2024-07-15 11:24:55
 * @create [2024-07-15 11:24:55] [zqb] [代码生成器生成]
 */
@Repository
public interface BHl7GmMapper extends SuperMapper<BHl7Gm> {

    default List<BHl7Gm> selectGmListByPatientIdentList(List<String> patientIdentList) {
        LambdaQueryWrapper<BHl7Gm> queryWrapper = new LambdaQueryWrapper<>();

        queryWrapper.eq(BHl7Gm::getIsDeleted, 0)
                .in(CollectionUtil.isNotEmpty(patientIdentList), BHl7Gm::getPatientIdent, patientIdentList);
        return this.selectList(queryWrapper);
    }

    default List<BHl7Gm> selectGmListByHospitalNumber(String hospitalNumber) {
        LambdaQueryWrapper<BHl7Gm> queryWrapper = new LambdaQueryWrapper<>();

        queryWrapper.eq(BHl7Gm::getIsDeleted, 0)
                .eq(StringUtils.isNotEmpty(hospitalNumber), BHl7Gm::getHospitalNumber, hospitalNumber);
        return this.selectList(queryWrapper);
    }
}


